package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootPersonSkill;
import org.footballmanager.pandafootball.system.form.SearchForm;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Setter
@Getter
public class FootPersonSkillSearchForm extends SearchForm implements Serializable {
    private static final long serialVersionUID = 8090668615941861535L;
    protected Long qyId;
    protected Long skillId;
    protected String number;
    protected Integer enabled;

    public Example buildSearchCommond() {
        Example example = new Example(FootPersonSkill.class);
        Example.Criteria criteria = example.createCriteria();
        if (!StringUtils.isEmpty(qyId)) {
            criteria.andEqualTo("qyId", qyId);
        }
        if (!StringUtils.isEmpty(skillId)) {
            criteria.andEqualTo("skillId", skillId);
        }
        if (!StringUtils.isEmpty(number)) {
            criteria.andEqualTo("number", number);
        }
        criteria.andEqualTo("delFlag", 0);
        example.orderBy("createTime").desc();
        return example;
    }

}
